home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
windows
/
win31
/
macsyma.arj
/
MACSDEMO.EXE
/
BISECT.OUT
< prev
next >
Wrap
Text File
|
1993-09-15
|
1KB
|
43 lines
(c1) if get('bisect,'version)=false then load("bisect")$
C:\MACSD2B\share\bisect.fas being loaded.
(c2) /* For purposes of the demo, set convergence tolerances */
(bisect_dep_toler : 1.0e-7,
bisect_indep_toler : 1.0e-7) $
(c3) /* Finding the numerical root of an expression */
exp: x^5 - 5 ;
|$label(0,15,Times New Roman,$(d3$))$sup(x,5)$hinge()$in( - )5
(c4) root_by_bisection(eval(exp),x,1,2);
|$label(0,15,Times New Roman,$(d4$))1.37973
(c5) root_by_bisection(x^5-5,x,1,2);
|$label(0,15,Times New Roman,$(d5$))1.37973
(c6) %^5;
|$label(0,15,Times New Roman,$(d6$))4.99999
(c7) /* Equations are handled */
eqn: cos(x) = x;
|$label(0,15,Times New Roman,$(d7$))cos$paren(x)$hinge()$in( = )x
(c8) root_by_bisection(eval(eqn),x,0,1);
|$label(0,15,Times New Roman,$(d8$))0.73908
(c9) cos(%);
|$label(0,15,Times New Roman,$(d9$))0.73908
(c10) /* So are functions */
f(x) := sin(x)^2 - ''(sfloat(1/%pi));
|$label(0,15,Times New Roman,$(d10$))f$paren(x)$hinge()$in( := )$sup(sin,2)$paren(x)$in( - )0.31831
(c11) root_by_bisection('f,0,1);
|$label(0,15,Times New Roman,$(d11$))0.59945